package com.qfjy.homework.huajian;

import java.util.ArrayList;
import java.util.List;

public abstract   class AbstractSubject implements Subject {
    List<Observer>observers=new ArrayList<>();
    @Override
    public void add(Observer observer) {
        observers.add(observer);
    }

    @Override
    public void del(Observer observer) {
        observers.remove(observer);
    }

    @Override
    public void notifyObservers() {
        for (Observer o:observers) {
            o.update();
        }
    }


}
